Skip to content

fix(v10/nextjs): Apply top-level bundleSizeOptimizations to webpack and Turbopack builds - #25261

Merged
andreiborza merged 1 commit into
v10from
backport/v10-24818-nextjs-bundle-size-optimizations
Oct 12, 2026
Merged

andreiborza merged 1 commit into
v10from
backport/v10-24818-nextjs-bundle-size-optimizations

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Backport of: #24818

Differences to the original PR

  • packages/nextjs/src/{client,edge,server}/index.ts: the debug: true warning still mentions withSentryConfig({ disableLogger: true }). v10 still has the deprecated disableLogger option, which develop removed. The message now lists bundleSizeOptimizations.excludeDebugStatements: true, withSentryConfig({ disableLogger: true }), and webpack.treeshake.removeDebugLogging: true.
  • packages/nextjs/src/config/types.ts: left out the TODO comment change on the closing brace of _experimental.turbopackReactComponentAnnotation. On v10 that line has no TODO(v12) comment to replace. This only affects a comment.
  • packages/nextjs/src/config/withSentryConfig/getFinalConfigObjectBundlerUtils.ts: the ../util import leaves out supportsTurbopackRuleCondition, which v10 doesn't have. The new getTreeshakeDefines import is unchanged.
  • packages/nextjs/test/config/webpack/constructWebpackConfig.test.ts: the new test spies on core.loadModule instead of coreServer.loadModule. On v10 this test file imports @sentry/core as core and has no coreServer import.
  • packages/nextjs/test/config/withSentryConfig.test.ts: the existing v10 test adds a turbopack note when the deprecated option only applies to webpack now passes { ...exportedNextConfig } instead of the shared fixture. On v10, disableLogger maps to webpack.treeshake.removeDebugLogging. With Turbopack enabled, the new maybeSetTurbopackTreeshakeDefines writes compiler.define onto the passed config. That change leaked into the shared fixture and broke the new Turbopack treeshake tests. This only changes tests.

Reviewer note: because disableLogger maps to webpack.treeshake.removeDebugLogging on v10, disableLogger: true now also removes debug logging in Turbopack builds. The existing deprecation warning for disableLogger still adds "(Not supported with Turbopack.)". This backport leaves that warning unchanged.

via Junior system actor junior.

--

View Junior Session [Sentry]

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.23 kB added added
@sentry/browser - with treeshaking flags 26.67 kB added added
@sentry/browser (incl. Tracing) 47.11 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 48.91 kB added added
@sentry/browser (incl. Tracing, Profiling) 51.9 kB added added
@sentry/browser (incl. Tracing, Replay) 86.52 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.15 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 91.26 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 103.9 kB added added
@sentry/browser (incl. Feedback) 45.41 kB added added
@sentry/browser (incl. sendFeedback) 33.03 kB added added
@sentry/browser (incl. FeedbackAsync) 38.17 kB added added
@sentry/browser (incl. Metrics) 29.32 kB added added
@sentry/browser (incl. Logs) 29.55 kB added added
@sentry/browser (incl. Metrics & Logs) 30.23 kB added added
@sentry/react 30.03 kB added added
@sentry/react (incl. Tracing) 49.45 kB added added
@sentry/vue 34.04 kB added added
@sentry/vue (incl. Tracing) 49.51 kB added added
@sentry/svelte 28.25 kB added added
CDN Bundle 30.6 kB added added
CDN Bundle (incl. Tracing) 49.07 kB added added
CDN Bundle (incl. Logs, Metrics) 32.17 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 50.41 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 71.6 kB added added
CDN Bundle (incl. Tracing, Replay) 86.78 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.05 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 92.57 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.87 kB added added
CDN Bundle - uncompressed 90.97 kB added added
CDN Bundle (incl. Tracing) - uncompressed 147.97 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 95.68 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 151.95 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 221.03 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 267.79 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 271.75 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 281.49 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.44 kB added added
@sentry/nextjs (client) 52 kB added added
@sentry/sveltekit (client) 47.56 kB added added
@sentry/core/server 81.53 kB added added
@sentry/core/browser 67.64 kB added added
@sentry/node-core 63.87 kB added added
@sentry/node 127.02 kB added added
@sentry/node (incl. diagnostics channel injection) 171.16 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B added added
@sentry/node/light 51.99 kB added added
@sentry/node - without tracing 75.66 kB added added
@sentry/aws-serverless 84.81 kB added added
@sentry/cloudflare (withSentry) - minified 204.74 kB added added
@sentry/cloudflare (withSentry) 504.74 kB added added

@andreiborza
andreiborza requested a review from chargome October 12, 2026 10:59
@andreiborza
andreiborza marked this pull request as ready for review October 12, 2026 11:01
@andreiborza
andreiborza requested a review from a team as a code owner October 12, 2026 11:01
@andreiborza
andreiborza requested review from nicohrubec and removed request for a team October 12, 2026 11:01
@andreiborza
andreiborza merged commit 4930a45 into v10 Oct 12, 2026
84 checks passed
@andreiborza
andreiborza deleted the backport/v10-24818-nextjs-bundle-size-optimizations branch October 12, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants